package com.suixinsanren.algorithm.sort.bubble.demo05;

import org.junit.Test;

import java.util.Arrays;
import java.util.Random;

public class BubbleTestDrive {

    private final int ARR_LENGTH = 10;

    private final int RANDOM_NUMBER_SCOPE = 100;

    private final int[] arr = new int[ARR_LENGTH];

    private Random random = new Random(System.currentTimeMillis());


    public void init() {
        for (int i = 0; i < arr.length; i++) {
            arr[i] = random.nextInt(RANDOM_NUMBER_SCOPE);
        }
    }

    @Test
    public void cycleTest() {
        for (int i = 0; i < 10; i++) {
            init();
            printArr();
            BubbleSort.sort(arr);
            printArr();
            System.out.println("------------------------");
        }
    }

    public void printArr() {
        System.out.println(Arrays.toString(arr));
    }
}
